<template>
  <div class="fullscreen">
    <svg-icon icon-class="fullscreen" @click="toggle" />
  </div>
</template>

<script>
import screenfull from 'screenfull'
export default {
  name: 'ScreenFull',
  methods: {
    toggle() {
      if (screenfull.isEnabled) {
        screenfull.toggle()
      } else {
        this.$message.error('当前浏览器不支持全屏')
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.fullscreen {
  margin-right: 20px;
  line-height: 50px;
  svg {
    color: #fff;
    width: 20px;
    height: 20px;
  }
}
</style>
